<?php echo $this->render('head.phtml');?>
<script src="/static/js/jquery.cookie.js"></script>
<script src="/static/js/jquery.validate.js"></script>
<script src="/static/js/messages_cn.js" charset="UTF-8"></script>
<script>$(document).ready(function(){
    $(".check_form").validate({
	rules:
	{
      	    license: "required",
	    username: 
	    {
		required:true,
		remote: {url:"/utility/check-username"}
	    },
	    password: "required",
	    repassword: {required: true, equalTo: "#input_password"},
	    captcha: "required"
	},
	messages:
	{
      	    license: "必须要同意协议",
	    username: {requied:"请输入用户名或者电子邮箱",remote: "此用户名已被使用"},
	    password: {required: "请输入密码"},
	    repassword: {requied:"请再次输入密码", equalTo:"两次输入密码不一致"},
	    captcha: "请输入验证码"
	}
    });

    if($.cookie('remember_me') == "on")
    {
	$('#login_username').val($.cookie('username'));
	$('#login_password').val($.cookie('password'));
	$('#login_remember_me').attr("checked", "checked");
    }
});
</script>
<style>
label.error{color: red;}
</style>

<div id='div_register_login' class='container_24 div_content ui-corner-all'>
  <div id="div_register" class='grid_13 prefix_1'>
    <label class='register_title'>新用户注册</label> 
    
    <form action="/account/register" method='post' class="check_form">
      <table id='table_register'>
	<tr>
	  <td class='td_desc'>用户名或电子邮箱：</td>
	  <td><input type='text' name='username' id='input_username' minlength="2" maxlength="30"
		     value='<?php if (isset($this->postRegisterData['username']))echo $this->postRegisterData['username'];?>'/>
	  </td>
	  <td>
	    <label class='lb_error' id='lb_useranme_error'>
	      <?php if (isset($this->register_errors['username']))echo $this->register_errors['username'];?>
	    </label>
	  </td>
	</tr>
	<!-- <tr> -->
	<!--   <td class='td_desc'>昵称：</td><td><input type='text' name='nickname' value="<?php if ($this->postRegisterData['nickname'])echo $this->postRegisterData['nickname'];?>"/></td> -->
	<!--   <td><label class='lb_error' id='lb_nickname_error'><?php if (isset($this->register_errors['nickname']))echo $this->register_errors['nickname'];?></label></td> -->
	<!-- </tr> -->
	<tr>
	  <td class='td_desc'>密码：</td><td><input type='password' name='password' minlength="6" maxlength="12" id='input_password' value="<?php if (isset($this->postRegisterData['password']))echo $this->postRegisterData['password'];?>"/></td>
	</tr>
	<tr>
	  <td class='td_desc'>再次输入密码：</td><td><input type='password' name='repassword'  minlength="6" maxlength="12" id='input_repassword' value="<?php if (isset($this->postRegisterData['password']))echo $this->postRegisterData['password'];?>"/></td>
	  <td><label class='lb_error' id='lb_password_error'><?php if (isset($this->register_errors['password']))echo $this->register_errors['password'];?></label></td>
	</tr>
	<tr>
	  <td class='td_desc'>验证码：</td>
	  <td><input type="text" name="captcha" class="required" maxlength="6" value="<?php echo $this->captchaId; ?>" /></td>
	  <td><label class='lb_error'><?php if (isset($this->register_errors['captcha']))echo $this->register_errors['captcha'];?></label></td>
	</tr>
	<tr>
	  <td>&nbsp;</td>
	  <td>
	    <span id="captcha">
	      <img id="captcha_img" src="<?php echo $this->captcha_url; ?>" border="0" />
	    </span>
	    <a href="#" id="changeCaptcha">换一张</a>
	  </td>
	</tr>
	<!-- <tr> -->
	<!--   <td>&nbsp;</td><td colspan='2'><input type='checkbox' class="required" name='license' <?php if ($this->postRegisterData['license']) echo 'checked';?> /><label id='lb_declare'>我已阅读并接受<a class='a_declare' href=''>注册协议</a>和<a class='a_declare' href=''>版权声明</a></label></td> -->
	<!-- </tr> -->
	<tr>
	  <td>&nbsp;</td><td><input type='submit' name='' value='注册'/></td>
	</tr>
	<tr>
	  <td></td>
	  <td><span class="red"><?php echo $this->error;?></span></td>
	</tr>
      </table>
    </form>
  </div>

  <div id='vertical_line' class='grid_1'></div>
  <div id='div_login'  class='grid_8 prefix_1'>
    <label class='register_title'>登录</label> 
    
    <form action="/account/login" method='post' >
      <table id='table_login'>
	<tr>
	  <td class='td_desc'>用户名或电子邮箱：</td><td><input type='text' id='login_username' class="required" name='username' value="<?php //echo $this->login_user;echo $_COOKIE['username']?>"/></td>
	</tr>
	<tr>
	  <td class='td_desc'>密码：</td><td><input type='password' id='login_password' name='password' class="required"  value='<?php echo $this->login_passwd;?>'/></td>
	</tr>
	<tr>
	  <td>&nbsp;</td><td><label><input type='checkbox' id='login_remember_me' name='remember_me'/>记住我</label></td>
	</tr>
	<tr>
	  <td><label class='lb_error'><?php echo $this->login_error;?></label></td>
	</tr>
	<tr>
	  <td>&nbsp;</td><td><input type='submit' value='登录'/></td>
	</tr>

      </table>
    </form>
  </div><!-- div_login -->
  <div class='clear'></div>
   
</div>
<?php echo $this->render('foot.phtml');?>
